package com.ruoyi.feign;

import com.ruoyi.entity.TodoTaskOutResp;
import com.ruoyi.feign.fallback.TodoServiceClientFallback;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import io.github.resilience4j.retry.annotation.Retry;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient(name = "mytools", fallback = TodoServiceClientFallback.class)
public interface TodoServiceClient {

    // 假设目标服务有一个获取数据的接口
    @Retry(name = "mot-retry")
    @CircuitBreaker(name = "mot-circuit-breaker")
    @GetMapping("/api/todos/getStatisticsTask")
    @ResponseBody
    TodoTaskOutResp getStatisticsTask(@RequestParam(value = "userId", required = false) String userId);
}
